#!/bin/bash

echo "Comparing:"
echo "--- '$1'"
echo "+++ '$2'"
sortify() {
  sort --key=1 --field-separator=' ' --parallel=4 --unique "$@"
}
diff -u0 <(sortify "$1") <(sortify "$2") |grep -v "\+\#"|grep -v "\-\#" | grep -v "^\@\@"|grep -v "^\+$"|grep -v "^\-$" | colordiff

#ok bad way, must not sort the diff, but the source files first! or else some things would show up as + whhen in fact they are not + nor - but just in a different position in the file!
#diff -u0 "$1" "$2" |grep -v "\+\#"|grep -v "\-\#" | grep -v "^\@\@"|grep -v "^\+$"|grep -v "^\-$"|grep -Ev '^(\+\+\+|---) '|sed -re 's/^([+-])(.*)/\1 \2/g'| sort --key=2 --field-separator=' ' --parallel=4 --unique
#|colordiff

